/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

package RDA;

import org.newdawn.slick.Color;
import org.newdawn.slick.GameContainer;
import org.newdawn.slick.Graphics;
import org.newdawn.slick.Image;
import org.newdawn.slick.state.StateBasedGame;

/**
 *
 * @author raul
 */
public class NaveWida extends NaveBase{
int puntuancion;
    int vidas;  //vidas nabe se aprobexa como contador si eso
    int muertes;    //contador muertes

    public NaveWida(float vidaNave, float vidaNaveT,int vidas, Disparo disparo, Image nau, Image nauDestroy){
        super(vidaNave, vidaNaveT, disparo, nau, nauDestroy);
        this.vidas = vidas;
    }

    @Override
    public void update(GameContainer gc, StateBasedGame sb, int delta) {
    }

    @Override
    public void render(GameContainer gc, Graphics g){
        if(!(super.isDestruido() && vidas==1)){
            if(!(super.isDestruido())){
                g.drawImage(nave, x, y);
            }else{
                g.drawImage(explosion, x, y);
                vidas--;
                super.x = 350;
                super.y = 800;
                super.destruido = false;
                vidaNave = vidaTotalNave;
                g.drawImage(nave, x, y);
                muertes++;
            }
        }else {
            muertes++;
            super.destruido = true;
        }
    }

    public void renderVida(GameContainer gc, Graphics g) {
        if (vidaNave > 0) {
            g.setColor(Color.red);
            g.fillRect(30, 10, (vidaNave / vidaTotalNave) * 200, 15);
        }
        g.setColor(Color.white);
        g.drawRect(30, 10, 200, 15);
    }

    public void renderVides(GameContainer gc, Graphics g) {
        for (int i = 0; i < vidas; i++) {
            g.setColor(Color.white);
            g.fillRect(500+i*25, 10, 20, 20);
        }
    }

    public Disparo getProjectil() {
        return disparo.clonarDisparo();
    }

    public int getPuntuancion() {
        return puntuancion;
    }

    public void setPuntuancion(int puntuancion) {
        this.puntuancion += puntuancion;
    }


}
